{{include file=head.tpl}}
	<div class="content">
		<div class="content_left">
			<div class="content_left_main">
				<div class="title"><h1>{{$data['title']}}</h1></div>
				<div class="hack">
					<span class="time">{{$data['posttime']}}</span>
					<span class="source">来源:<a href="{{$data['source_url']}}">{{$data['source']}}</a></span>
					<span class="clicks">浏览:<i id="clicks">{{$data['clicks']}}</i>次</span>
					<span class="clicks">评论:<i id="comment_num">{{$data['comment_num']}}</i>条</span>
				</div>
				<div class="text">
					{{$data['content']}}
				</div>
				{{$module_more}}
				<div class="page">{{$Get_Page}}</div>
				<div class="keyword_author">
					<div class="keyword">
						关键字：{{$data['keyword']}}
					</div>
					<div class="author">
						作者：{{$data['author']}}
					</div>
				</div>
				<div class="share">
					<div class="bdsharebuttonbox">
						<a class="bds_count" data-cmd="count"></a>
						<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信">微信</a>
						<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间">QQ空间</a>
						<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博">新浪微博</a>
						<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博">腾讯微博</a>
						<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网">人人网</a>
						<a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友">QQ好友</a>
						<a href="#" class="bds_more" data-cmd="more">分享到：</a>
					</div>
					<script>
						window._bd_share_config = {
							"common": {
								"bdSnsKey": {},
								"bdText": "{{$data['title']}}",
								"bdDesc" : "{{$data['description']}}",
								"bdMini": "2",
								"bdMiniList": false,
								"bdPic": "{{$data['thumb']}}",
								"bdStyle": "1",
								"bdSize": "16"
							},
							"share": {
								"bdSize": 16
							},
							"image": {
								"viewList": ["qzone", "tsina", "tqq", "renren", "sqq", "weixin"],
								"viewText": "分享到：",
								"viewSize": "24"
							},
							"selectShare": {
								"bdContainerClass": null,
								"bdSelectMiniList": ["qzone", "tsina", "tqq", "renren", "sqq", "weixin"]
							}
						};
						with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];
					</script>
				</div>
			</div>
			<div id="comment_list">
				<div class="comment_list">
					<div id="null"></div>
				</div>
				<div id="comment_page"></div>
			</div>
			<div class="comment">
				<div class="comment_list_sort">
					<div class="sort">
						<span>我来说两句</span>
						<span>
							不管本信息如何，都邀请您在下面说几句...
						</span>
					</div>
				</div>
				<div class="comment_list_sort_add">
					<form class="layui-form" action="">
						<div class="layui-form-item layui-form-text">
							<label class="layui-form-label">评论内容</label>
							<div class="layui-input-block">
								<textarea id="comment_content" name="content" placeholder="请输入内容" class="layui-textarea" lay-verify="required|content"></textarea>
							</div>
						</div>
						
						
						<if condition="!C(MODULE.'|SETTING.add_comment_yzm')">
						<div class="layui-form-item layui-form-text" id="comment_yzm">
							<label class="layui-form-label">验证码</label>
							<div class="layui-input-block">
								<input name="yz_code" placeholder="验证码" class="layui-input" id="yz_code" type="text">
								<img src="{{WEBURL}}/Verification_Code{{C('HTML')}}" alt="点击图片更换验证码" title="点击图片更换验证码" class="yzimg"  onclick="this.src='{{WEBURL}}/Verification_Code/index/index/'+Math.random();"/>
							</div>
						</div>
						</if>
						<div class="layui-form-item commentbutton">
							<input type="hidden" name="aid" value="{{$data['aid']}}" />
							<button class="layui-btn" lay-submit="" lay-filter="button">提交</button>
						</div>
					</form>
				</div>
			</div>
		</div>
		<div class="comment_Reply">
	    	<form class="layui-form" action="">
	    		<div class="layui-form-item">
	    			<label class="layui-form-label">回复内容</label>
	    			<div class="layui-input-block">
	    				<textarea id="comment_Reply_content" name="content" placeholder="请输入内容" class="layui-textarea" lay-verify="required|content"></textarea>
	    			</div>
	    		</div>
	    		<div class="layui-form-item" id="commentReply_yzm"></div>
	    		<div class="layui-form-item">
	    			<div class="layui-input-block ">
	    				<input type="hidden" name="aid" value="{{$data['aid']}}" />
	    				<button class="layui-btn" lay-submit="" lay-filter="comment_Reply_button">回复</button>
	    			</div>
	    		</div>
	    		<div id="reply_id"></div>
	    	</form>
	    </div>
		<script>
			var allnum=Number({{$data['comment_num']}});
			var login="";
			var comment_add=true;
			var page=1;
			var commentReply="";
			layui.use(['form', 'layedit','layer','laypage'], function() {
				var form = layui.form,
					layer = layui.layer,
					laypage = layui.laypage,
					layedit = layui.layedit;
				//自定义验证规则
				form.verify({
					content: function(value) {
						if(value.length < 5) {
							return '评论内容至少得5个字符';
						}
					}
				});
				//监听评论提交
				form.on('submit(button)', function(data) {
					$.ajax({
						url:"{{M_WEBURL}}/comment/post",
					    type: 'POST',
					    data:data.field,
					    dataType: 'json',
					    success: function(data){
					    	if(data.code=='19'){
					    		login=layer.open({
								    type: 2 //此处以iframe举例
								    ,title: '登录提醒'
								    ,area: ['390px', '260px']
								    ,shadeClose:true
								    ,shade: [0.8, '#393D49']
								    ,content: '{{WEBURL}}/login/index/small_login/tpl/login'
								});
					    		return false;
					    	}else if(data.code=='501' || data.code=='502' || data.code=='503'){
					    		layer.msg(data.text, {
								    time: 20000, //20s后自动关闭
								    btn: ['确定']
								    ,shadeClose:true
							        ,shade: [0.8, '#393D49']
								});
					    		return false;
					    	}else if(data.code=='9'){
					    		$(".comment_Reply .yzimg").click();
					    		layer.msg(data.text, {
								    time: 20000, //20s后自动关闭
								    btn: ['确定']
								    ,shadeClose:true
							        ,shade: [0.8, '#393D49']
								});
					    		return false;
					    	}else{
					    		$('#null').html('');
						    	allnum=allnum+1;
						    	$(".comment_list_sort_add .yzimg").click(); 
						    	$('#comment_content').val('');
						    	$('#yz_code').val('');
						    	$('#yz_code').focusout();
						    	comment_add=false;
						    	template(data.id,data.reply_id,data.text.username,data.text.content,data.text.username,data.text.posttime,'1');
					    	}
					    	
					    }
					});
					return false;
				});
				function get_comment_list(page){
					comment_add=true;
					$.ajax({
							url:"{{M_WEBURL}}/comment/alllist/aid/{{$data['aid']}}/page/"+page+"/step/json{{C('HTML')}}",
						    type: 'POST',
						    dataType: 'json',
						    success: function(data){
						    	if(data){
						    		$('.comment_list').empty();
							    	for(var i=0; i<data.length;i++){
							    		template(data[i].id,data[i].reply_id,data[i].username,data[i].content,data[i].username,data[i].posttime,data[i].quanxian);
							    		if(data[i].list){
							    			FOR_comment_list(data[i].list);
							    		}
							    	}
						    	}else{
						    		$('#null').html('<div class="none">暂无评论....</div>');
						    	}
						    	
						    }
					})
				}
				
				function FOR_comment_list(data){
					
					for(var i=0; i<data.length;i++){
						template(data[i].id,data[i].reply_id,data[i].username,data[i].content,data[i].username,data[i].posttime,data[i].quanxian);
						if(data[i].list){
							FOR_comment_list(data[i].list);
						}
					}
				}
				
				function template(a,b,c,d,e,f,g){
					var quanxian="";
					if(g =='1' || g =='2'){
						quanxian='<a href="javascript:void(0)" onclick="javascript:comment_del('+a+')">删除</a>';
					}
					var htm='<fieldset class="layui-elem-field" id="comment_list_'+a+'">'+
								'<legend>'+c+'</legend>'+
								'<div class="layui-field-box">'+
									d+
								'</div>'+
								'<div class="comment_list_action">'+
									'<span>发布人：'+e+'</span>'+
									'<span>时间：'+f+'</span>'+
									'<a href="javascript:void(0)" onclick="javascript:comment_Reply('+a+')">回复</a>'+
									quanxian+
								'</div>'+
								'<div id="new_Reply_'+a+'"></div>'+
							'</fieldset>'; 
					if(comment_add==true){
						if(b){
							if($('#comment_list_'+b).length>0){
					    		$("#comment_list_"+b).append(htm);
					    	}else{
					    		$(".comment_list").append(htm);
					    	}
						}else{
							$(".comment_list").append(htm);
						}
						
					}else{
						if(b){
							if($('#new_Reply_'+b).length>0){
					    		$("#new_Reply_"+b).append(htm);
					    	}else{
					    		$(".comment_list").prepend(htm);
					    	}
						}else{
							$(".comment_list").prepend(htm);
						}
					}
				}
				laypage.render({
					elem: 'comment_page'
					,count: allnum //数据总数，从服务端得到
					,groups:5
					,jump: function(obj, first){
						get_comment_list(obj.curr);
					},
					layout:['prev', 'page', 'next'],
				});
				//监听评论提交
				form.on('submit(comment_Reply_button)', function(data) {
					$.ajax({
						url:"{{M_WEBURL}}/comment/post",
					    type: 'POST',
					    data:data.field,
					    dataType: 'json',
					    success: function(data){
					    	if(data.code=='19'){
					    		login=layer.open({
								    type: 2 //此处以iframe举例
								    ,title: '登录提醒'
								    ,area: ['390px', '260px']
								    ,shadeClose:true
								    ,shade: [0.8, '#393D49']
								    ,content: '{{WEBURL}}/login/index/small_login/tpl/login'
								});
					    		return false;
					    	}else if(data.code=='501' || data.code=='502' || data.code=='503'){
					    		layer.msg(data.text, {
								    time: 20000, //20s后自动关闭
								    btn: ['确定']
								    ,shadeClose:true
							        ,shade: [0.8, '#393D49']
								});
					    		return false;
					    	}else if(data.code=='9'){
					    		$(".comment_Reply .yzimg").click();
					    		layer.msg(data.text, {
								    time: 20000, //20s后自动关闭
								    btn: ['确定']
								    ,shadeClose:true
							        ,shade: [0.8, '#393D49']
								});
					    		return false;
					    	}else{
						    	layer.close(commentReply);
						    	comment_add=false;
						    	$('#comment_Reply_content').val('');
								$('#commentReply_yzm').html('');
						    	$(".comment_list_sort_add .yzimg").click();
						    	$('#yz_code').val('');
						    	template(data.id,data.reply_id,data.text.username,data.text.content,data.text.username,data.text.posttime,'1');
							}
					    }
					});
					return false;
				});
			});
			function comment_del(id){
					$.ajax({
						url:"{{M_WEBURL}}/comment/del",
						type: 'POST',
						data:{'aid':"{{$data['aid']}}",'id':id},
						dataType: 'json',
						success: function(data){
						    if(data.code=='504' || data.code=='505'){
						    	layer.msg(data.text, {
								    time: 20000, //20s后自动关闭
								    btn: ['确定']
								    ,shadeClose:true
							        ,shade: [0.8, '#393D49']
								});
						    }else if(data.code==0){
						    	allnum=allnum-1;
						    	$('#comment_list_'+id).remove();
						    }else{
						    	alert('异常错误');
						    }
						}
					})
			}
			function comment_Reply(id) {
				 	$('#reply_id').html("<input type='hidden' name='reply_id' value='"+id+"' />'"); 	
					if($('#comment_yzm').length>0){
					    $('#commentReply_yzm').html($('#comment_yzm').html()); 	
					}
					commentReply=layer.open({
						type: 1
						,title: '评论回复'
						,area: ['540px', '300px']
						,shadeClose:false
						,shade: [0.8, '#393D49']
						,content: $('.comment_Reply')
						,cancel: function(index, layero){
							$('#comment_Reply_content').val('');
							$('#commentReply_yzm').html('');
							$(".comment_list_sort_add .yzimg").click();
						    layer.close(index);
						  	return false; 
						}
					});
			}
		</script>
		<div class="content_right">
			<div class="content_right_content main_content_2">
				<div class="sort">
					<span>最新图片</span>
					<span>
						<a href="{{U(['cid'=>2],MODULE)}}">更多》</a>
					</span>
				</div>
				<ul class="photo_list list">
					<sql out="new_photo" from="M_jab.article"  select="*" start_limit="0" where="state='1' AND is_pic='1'" order="aid" by="desc" limit="9">
					<foreach array="new_photo">
						<li>
							<a href="{{U(['aid'=>$row['aid'],'cid'=>$row['cid']],MODULE)}}" title="{{$row['title']}}">
								<img src="{{get_img_url($row['thumb'])}}" alt="{{$row['title']}}"/>
								<div class="title">{{$row['title']}}</div>
							</a>	
						</li>
					</foreach>
				</ul>
			</div>
			
			<div class="category_right_content main_content_2">
				<div class="sort">
					<span>最新资讯</span>
					<span>
						<a href="{{U(['cid'=>1],MODULE)}}">更多》</a>
					</span>
				</div>
				<ul class="list">
					<sql out="news" from="M_jab.article"  select="*" start_limit="0" where="state='1'" order="aid" by="desc" limit="10">
					<foreach array="news">
						<li>
							<a href="{{U(['aid'=>$row['aid'],'cid'=>$row['cid']],MODULE)}}" title="{{$row['title']}}">{{Get_word_strpos($row['title'],'20')}}</a>
							<span class="time">{{date('Y-m-d H:i:s',$row['posttime'])}}</span>
						</li>
					</foreach>
				</ul>
			</div>
		</div>
		<div class="c"></div>
	</div>
	{{include file=foot.tpl}}
